package demo1;

// 牛客网:数字统计
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int l = scanner.nextInt();
        int r = scanner.nextInt();
        int count = 0;
        for(int i = l; i<=r; i++) {
            int t = i;
            while(t!=0) {
                if(t%10==2) {
                    count++;
                }
                t/=10;
            }
        }
        System.out.println(count);
    }
}